package com.lighting.smssystem.configuration;

import com.lighting.smssystem.aspect.RoleAccessException;
import com.lighting.smssystem.utils.BaseResponse;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author leemaster
 * @Title: ExceptionConfiguration
 * @Package com.lighting.smssystem.configuration
 * @Description:
 * @date 2019-06-0414:41
 */
@Configuration
@ControllerAdvice
public class ExceptionConfiguration {

    @ExceptionHandler(RoleAccessException.class)
    public @ResponseBody
    BaseResponse hanldeRoleException(RoleAccessException e){
        return new BaseResponse(403,e.getMessage(),null);
    }
}
